FROM centos:7 as buildstage
RUN sed -e 's|^mirrorlist=|#mirrorlist=|g'\
        -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos|g' \
        -i.bak \
        /etc/yum.repos.d/CentOS-Base.repo
RUN yun install -y centos-release-scl
RUN yum makecache
RUM yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils make
WORKDIR /src
COPY ./main.cpp .
RUN source /opt/rh/devtoolset-9/ensable&& g++ main.cpp -o mycppweb -lpthread
CMD ["/src/mycppweb"]

FROM centos:7
COPY --from=buildstage /src/mycppweb /
CMD ["/mycppweb"]
